﻿using System;

namespace IOA.MES.Common
{
    /// <summary>
    /// 多语言业务异常
    /// </summary>
    public class MultiLanBizException : Exception
    {
        /// <summary>
        /// 位置异常代码
        /// </summary>
        public static int UnKnowErrCode = 999999999;

        /// <summary>
        /// 错误代码
        /// </summary>
        public int ErrCode { get; set; }

        /// <summary>
        /// 错误参数
        /// </summary>
        public string ErrParas { get; set; }

        /// <summary>
        /// 业务异常
        /// </summary>
        /// <param name="errCode">错误代码</param>
        /// <param name="errParas">错误信息</param>
        public MultiLanBizException(int errCode, string errParas = "") : base($"错误代码：{errCode}，参数：{errParas}")
        {
            this.ErrParas = errParas;
            this.ErrCode = errCode;
        }

        /// <summary>
        /// 业务异常
        /// </summary>
        /// <param name="errCode">错误代码</param>
        /// <param name="errParas">错误信息</param>
        /// <param name="innerException">内部异常</param>
        public MultiLanBizException(int errCode, Exception innerException, string errParas = "") : base($"错误代码：{errCode}，参数：{errParas}", innerException)
        {
            this.ErrParas = errParas;
            this.ErrCode = errCode;
        }
    }
}
